package com.eig.courseweb.controller;

import com.eig.common.entity.course.Chapter;
import com.eig.common.vo.Result;
import com.eig.courseweb.service.ChapterService;
import com.eig.courseweb.vo.CourseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.annotation.Resource;

/**
 * @author ：StudentLsj（李世界）
 * @date ：Created in 2023/01/11 下午 07:52
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("core/chapter")
@Api(tags = "课程大纲")
@EnableSwagger2
public class ChapterController {

    @Resource
    private ChapterService chapterService;

    @PostMapping("/findChapterById/{id}")
    @ApiOperation(value = "课程大纲")
    public Result findChapterById(@PathVariable String id) {
        return chapterService.findChapterById(id);
    }

    @PostMapping("/insertChapterWithCourseId")
    @ApiOperation(value = "添加")
    public Result insertChapterWithCourseId(@RequestBody CourseVo courseVo) {
        return chapterService.insertChapterWithCourseId(courseVo);
    }
    @PostMapping("/deleteChapterWithCourseId")
    @ApiOperation(value = "删除")
    public Result deleteChapterWithCourseId(@RequestBody Chapter courseVo) {
        return chapterService.deleteChapterWithCourseId(courseVo);
    }
}
